done
$OSTREE init --repo=ostree/repo
- (cd ostree/gnomeos-origin; find . '!' -type p | grep -v '^.$' | $OSTREE commit -s 'Initial import' --repo=../repo --from-stdin)
+ (cd ostree/gnomeos-origin; find . '!' -type p | grep -v '^.$' | $OSTREE commit -b gnomeos -s 'Initial import' --repo=../repo --from-stdin)
)
if test -d ${OBJ}; then
mv ${OBJ} ${OBJ}.old
cp ${SRCDIR}/debian-setup.sh ostree/gnomeos-origin/
chroot ostree/gnomeos-origin ./debian-setup.sh
rm ostree/gnomeos-origin/debian-setup.sh
- (cd ostree/gnomeos-origin; find . '!' -type p | grep -v '^.$' | $OSTREE commit -s 'Run debian-setup.sh' --repo=../repo --from-stdin)
+ (cd ostree/gnomeos-origin; find . '!' -type p | grep -v '^.$' | $OSTREE commit -b gnomeos -s 'Run debian-setup.sh' --repo=../repo --from-stdin)
# This is the name for the real rootfs, not the chroot
(cd ostree/gnomeos-origin;
mkdir sysroot;
- $OSTREE commit -s 'Add sysroot' --repo=../repo --add=sysroot)
+ $OSTREE commit -b gnomeos -s 'Add sysroot' --repo=../repo --add=sysroot)
(cd ostree;
- rev=$($OSTREE rev-parse --repo=repo master)
+ rev=$($OSTREE rev-parse --repo=repo gnomeos)
$OSTREE checkout --repo=repo ${rev} gnomeos-${rev}
$OSTREE run-triggers --repo=repo gnomeos-${rev}
ln -s gnomeos-${rev} current
gboolean
ostree_repo_commit (OstreeRepo *self,
- const char *branch,
- const char *subject,
- const char *body,
- GVariant *metadata,
- const char *base,
- GPtrArray *modified_files,
- GPtrArray *removed_files,
- GChecksum **out_commit,
- GError **error)
+ const char *branch,
+ const char *parent,
+ const char *subject,
+ const char *body,
+ GVariant *metadata,
+ const char *base,
+ GPtrArray *modified_files,
+ GPtrArray *removed_files,
+ GChecksum **out_commit,
+ GError **error)
{
OstreeRepoPrivate *priv = GET_PRIVATE (self);
gboolean ret = FALSE;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
g_return_val_if_fail (priv->inited, FALSE);
+ g_return_val_if_fail (branch != NULL, FALSE);
+ g_return_val_if_fail (subject != NULL, FALSE);
- if (branch == NULL)
- branch = "master";
+ if (parent == NULL)
+ parent = branch;
- if (!resolve_rev (self, branch, TRUE, ¤t_head, error))
+ if (!resolve_rev (self, parent, TRUE, ¤t_head, error))
goto out;
if (current_head)
gboolean
ostree_repo_commit_from_filelist_fd (OstreeRepo *self,
const char *branch,
+ const char *parent,
const char *subject,
const char *body,
GVariant *metadata,
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
g_return_val_if_fail (priv->inited, FALSE);
+ g_return_val_if_fail (branch != NULL, FALSE);
+ g_return_val_if_fail (subject != NULL, FALSE);
- if (branch == NULL)
- branch = "master";
+ if (parent == NULL)
+ parent = branch;
/* We're overwriting the tree */
if (!import_root (self, base, &root, error))
goto out;
- if (!resolve_rev (self, branch, TRUE, ¤t_head, error))
+ if (!resolve_rev (self, parent, TRUE, ¤t_head, error))
goto out;
in = (GUnixInputStream*)g_unix_input_stream_new (fd, FALSE);
GVariant **out_variant,
GError **error);
-gboolean ostree_repo_commit (OstreeRepo *self,
+gboolean ostree_repo_commit (OstreeRepo *self,
const char *branch,
+ const char *parent,
const char *subject,
const char *body,
GVariant *metadata,
GChecksum **out_commit,
GError **error);
-gboolean ostree_repo_commit_from_filelist_fd (OstreeRepo *self,
+gboolean ostree_repo_commit_from_filelist_fd (OstreeRepo *self,
const char *branch,
+ const char *parent,
const char *subject,
const char *body,
GVariant *metadata,
static char *from_file;
static char *subject;
static char *body;
+static char *parent;
static char *branch;
static char **additions;
static char **removals;
{ "subject", 's', 0, G_OPTION_ARG_STRING, &subject, "One line subject", "subject" },
{ "body", 'm', 0, G_OPTION_ARG_STRING, &body, "Full description", "body" },
{ "branch", 'b', 0, G_OPTION_ARG_STRING, &branch, "Branch", "branch" },
+ { "parent", 'p', 0, G_OPTION_ARG_STRING, &parent, "Parent commit", "commit" },
{ "from-fd", 0, 0, G_OPTION_ARG_INT, &from_fd, "Read new tree files from fd", "file descriptor" },
{ "from-stdin", 0, 0, G_OPTION_ARG_NONE, &from_stdin, "Read new tree files from stdin", "file descriptor" },
{ "from-file", 0, 0, G_OPTION_ARG_FILENAME, &from_file, "Read new tree files from another file", "path" },
goto out;
}
+ if (!branch)
+ {
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "A branch must be specified with --branch");
+ goto out;
+ }
+
if (!subject)
{
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
for (iter = removals; *iter; iter++)
g_ptr_array_add (removals_array, *iter);
- if (!ostree_repo_commit (repo, branch, subject, body, NULL,
+ if (!ostree_repo_commit (repo, branch, parent, subject, body, NULL,
prefix, additions_array,
removals_array,
&commit_checksum,
}
from_fd = temp_fd;
}
- if (!ostree_repo_commit_from_filelist_fd (repo, branch, subject, body, NULL,
+ if (!ostree_repo_commit_from_filelist_fd (repo, branch, parent, subject, body, NULL,
prefix, from_fd, separator,
&commit_checksum, error))
{
gboolean ret = FALSE;
OstreeRepo *repo = NULL;
GOutputStream *pager = NULL;
+ const char *rev;
GVariant *commit = NULL;
- const char *rev = "master";
char *resolved_rev;
context = g_option_context_new ("- Show revision log");
if (prefix == NULL)
prefix = ".";
- if (argc > 1)
- rev = argv[1];
+ if (argc < 2)
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "A revision must be specified");
+ goto out;
+ }
+
+ rev = argv[1];
repo = ostree_repo_new (repo_path);
if (!ostree_repo_check (repo, error))
ot_repo="--repo=../repo"
export ot_repo
ostree init $ot_repo
- ostree commit $ot_repo -s "Test Commit 1" -m "Commit body first" --add=firstfile
- ostree commit $ot_repo -s "Test Commit 2" -m "Commit body second" --add=secondfile
+ ostree commit $ot_repo -b test -s "Test Commit 1" -m "Commit body first" --add=firstfile
+ ostree commit $ot_repo -b test -s "Test Commit 2" -m "Commit body second" --add=secondfile
ostree fsck -q $ot_repo
}
cd ../files
export ot_repo
ostree init $ot_repo
- ostree commit $ot_repo -s "Test Commit 1" -m "Commit body first" --add=firstfile
- ostree commit $ot_repo -s "Test Commit 2" -m "Commit body second" --add=baz/cow --add=baz/saucer --add=baz/deeper/ohyeah --add=baz/another/y
+ ostree commit $ot_repo -b test2 -s "Test Commit 1" -m "Commit body first" --add=firstfile
+ ostree commit $ot_repo -b test2 -s "Test Commit 2" -m "Commit body second" --add=baz/cow --add=baz/saucer --add=baz/deeper/ohyeah --add=baz/another/y
ostree fsck -q $ot_repo
}
repo="--repo=../repo"
ostree init $repo
echo 'ok init'
-ostree commit $repo -s "Test Commit" -m "Commit body" --add=yy
+ostree commit $repo -b test -s "Test Commit" -m "Commit body" --add=yy
echo 'ok commit'
ostree fsck -q $repo
echo 'ok fsck'
-ostree rev-parse
+ostree rev-parse $repo test
echo 'ok rev-parse'
repo="--repo=../repo"
ostree init $repo
echo 'ok init'
-ostree commit $repo -s "Test Commit 1" -m "Commit body first" --add=firstfile
+ostree commit $repo -b test -s "Test Commit 1" -m "Commit body first" --add=firstfile
echo 'ok commit 1'
-ostree commit $repo -s "Test Commit 2" -m "Commit body first" --add=secondfile
+ostree commit $repo -b test -s "Test Commit 2" -m "Commit body first" --add=secondfile
echo 'ok commit 2'
ostree fsck -q $repo
echo 'ok fsck'
setup_test_repository1
echo 'ok setup'
-ostree checkout $ot_repo master $test_tmpdir/checkout1-head
+ostree checkout $ot_repo test $test_tmpdir/checkout1-head
echo 'ok checkout cmd'
cd $test_tmpdir/checkout1-head
assert_has_file firstfile
setup_test_repository2
echo 'ok setup'
-ostree checkout $ot_repo master $test_tmpdir/checkout2-head
+ostree checkout $ot_repo test2 $test_tmpdir/checkout2-head
echo 'ok checkout cmd'
cd $test_tmpdir/checkout2-head
assert_has_file firstfile
echo '1..4'
setup_test_repository2
-ostree checkout $ot_repo master $test_tmpdir/checkout2-head
+ostree checkout $ot_repo test2 $test_tmpdir/checkout2-head
echo 'ok setup'
cd $test_tmpdir/checkout2-head
-ostree commit -s delete $ot_repo -r firstfile
+ostree commit $ot_repo -b test2 -s delete -r firstfile
echo 'ok rm firstfile'
assert_has_file firstfile # It should still exist in this checkout
cd $test_tmpdir
-ostree checkout $ot_repo master $test_tmpdir/checkout3-head
+ostree checkout $ot_repo test2 $test_tmpdir/checkout3-head
echo 'ok checkout 3'
cd $test_tmpdir/checkout3-head
assert_not_has_file firstfile
echo "1..2"
setup_test_repository2
-ostree checkout $ot_repo master $test_tmpdir/checkout2-head
+ostree checkout $ot_repo test2 $test_tmpdir/checkout2-head
cd $test_tmpdir/checkout2-head
mkdir -p a/nested/tree
echo one > a/nested/tree/1
echo anotherone > another/nested/tree/1
echo whee2 > another/whee
# FIXME - remove grep for .
-find | grep -v '^\.$' | ostree commit $ot_repo --from-stdin -s "From find"
+find | grep -v '^\.$' | ostree commit $ot_repo -b test2 -s "From find" --from-stdin
echo "ok commit stdin"
-ostree checkout $ot_repo master $test_tmpdir/checkout3-head
+ostree checkout $ot_repo test2 $test_tmpdir/checkout3-head
cd $test_tmpdir/checkout3-head
assert_has_file a/nested/2
assert_file_has_content a/nested/2 'two2'
echo "1..1"
setup_test_repository2
-ostree log $ot_repo > $test_tmpdir/log.txt
+ostree log $ot_repo test2 > $test_tmpdir/log.txt
assert_file_has_content $test_tmpdir/log.txt "Test Commit 1"
assert_file_has_content $test_tmpdir/log.txt "Test Commit 2"
echo "ok log"
setup_test_repository2
-ostree checkout $ot_repo master $test_tmpdir/checkout2-head
+ostree checkout $ot_repo test2 $test_tmpdir/checkout2-head
cd $ht_files
ln -s foo bar
-ostree commit $ot_repo -s "Add a symlink" -m "To test it" --add=bar
+ostree commit $ot_repo -b test2 -s "Add a symlink" -m "To test it" --add=bar
echo "ok commit symlink"
ostree fsck $ot_repo
echo "ok fsck"
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2011 Colin Walters <walters@verbum.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Author: Colin Walters <walters@verbum.org>
+
+set -e
+
+. libtest.sh
+
+echo '1..3'
+
+setup_test_repository2
+ostree checkout $ot_repo test2 $test_tmpdir/checkout2-head
+cd $test_tmpdir/checkout2-head
+echo test3file > test3file
+ostree commit $ot_repo -s 'Add test3file' -b test3 -p test2 --add test3file
+echo "ok commit test3 branch"
+ostree checkout $ot_repo test3 $test_tmpdir/checkout3-head
+echo "ok checkout test3 branch"
+cd $test_tmpdir/checkout3-head
+assert_has_file test3file
+echo "ok checkout test3file"